fix(orchestrator): stop failed phase-transition backend#21
Draft
cursor[bot] wants to merge 1 commit into
Draft
Conversation
Co-authored-by: Agentic-Worker <cskwork@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug and impact
During a mid-run phase transition,
_rebuild_backend_for_phasestopped the old backend and then started a fresh backend. Ifinitialize(), prompt rendering, orstart_session()failed after the fresh backend had started, the worker still held only the old backend reference and the fresh backend was never stopped. For subprocess-backed agents such as Codex app-server, repeated transition failures could leak orphaned processes and exhaust resources.Root cause
The fresh backend startup path was not wrapped in cleanup-on-failure logic, and the caller only rebinds
clientafter_rebuild_backend_for_phasereturns successfully.Fix
Wrap fresh backend start/initialize/session setup in a
tryblock and callnew_client.stop()before re-raising any failure. Log but do not mask cleanup failures.Validation
python3 -m pytest tests/test_orchestrator_phase_transition.py-> 10 passedPATH="/tmp/symphony-test-bin:$PATH" python3 -m pytest-> 275 passed, 2 skippedNote: the base container has
python3but nopython, so the full-suite rerun used a temporary/tmp/symphony-test-bin/python -> python3shim for the existing doctor test that checkspython -m symphony.mock_codex.